//
//  JZHFrendePulisTableViewCell.m
//  极致荟
//
//  Created by hetao on 14-5-11.
//  Copyright (c) 2014年 mac. All rights reserved.
//

#import "JZHFrendePulisTableViewCell.h"

@implementation JZHFrendePulisTableViewCell

- (void)awakeFromNib
{
    [self.headImage.layer setCornerRadius:6.0];
    [self.headImage.layer setMasksToBounds:YES];
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (IBAction)tongyi:(id)sender
{
    self.fr.requestType=RYESType;
    [self pusHttp:self.fr];
    [FriendRequest upData:self.fr];
}

- (IBAction)jujue:(id)sender
{
    self.fr.requestType=RNOType;
    [self pusHttp:self.fr];
    [FriendRequest upData:self.fr];
}

- (void)addCellData:(FriendRequest *)ouser
{
    self.fr=ouser;
    [ImageCache imageUrl:ouser.userHeadImage UiImageview:self.headImage];
    self.name.text=ouser.name;
    if(ouser.requestType==0)
    {
        self.status.hidden=YES;
        self.selcetview.hidden=NO;
    }else
    {
        self.status.hidden=NO;
        self.selcetview.hidden=YES;
    }
    
    if(ouser.requestType==1)
    {
        self.status.text=@"已同意";
    }
    if(ouser.requestType==-1)
    {
        self.status.text=@"已拒绝";
    }
    NSDateFormatter *form=[[NSDateFormatter alloc]init];
    [form setDateFormat:@"MM月dd日 hh:mm"];
    self.pdate.text=[form stringFromDate:ouser.requesetDate];
}

- (void)pusHttp:(FriendRequest *)fr
{
    NSDictionary *dic=[[NSDictionary alloc] initWithObjectsAndKeys:fr.rpId,@"attentionId", [NSNumber numberWithInt:[User defuceUser].userId],@"userId",[NSNumber numberWithInt:fr.requestType],@"status",nil];
    [HttpRequest httpRequestPost:JZHHTTPURL(@"friends/respondAttention") parameters:dic block:^(id data, HttpReturnCode rerurncode) {
        NSLog(@"%@",data);
         [self.mesg dbdata];
    }];
}
@end
